package com.yungu.swift.assets.driver.dao;

import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yungu.swift.assets.driver.model.dto.DriverQueueDto;
import com.yungu.swift.assets.driver.model.vo.JoinAssignDriverVo;
import com.yungu.swift.assets.driver.model.vo.QueueDriverVo;
import com.yungu.swift.assets.driver.model.vo.QueueSiteVO;
import com.yungu.swift.base.mapper.IMapper;
import com.yungu.swift.assets.driver.model.vo.QueueCityVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * DriverQueueMapper数据库操作接口类
 **/

public interface DriverQueueMapper<T extends DriverQueueDto> extends IMapper<T> {

    List<DriverQueueDto> finByList(Map<String, Object> params);

    int batchAdd(@Param("driverQueueDtos") List<T> driverQueueDtos);

    int batchDelByDri(Map<String, Object> params);


    PageList<JoinAssignDriverVo> queryByAssign(Map<String, Object> params, PageBounds pageBounds);

    /**
     * 查询排队中司机
     *
     * @param params
     * @return
     */
    PageList<QueueDriverVo> queryQueueDriver(Map<String, Object> params);

    /**
     * 查询空闲司机
     *
     * @param params
     * @return
     */
    PageList<JoinAssignDriverVo> queryFreeDriver(Map<String, Object> params, PageBounds pageBounds);

    //排队城市
    List<QueueCityVO> queueCity(String driverUuid);

    //排队位置点
    List<QueueSiteVO> queueSite(String driverUuid);

    /**
     * 更新城市
     * @param cityUuid
     * @param driverUuid
     * @return
     */
    @Update("update t_driver_queue set city_uuid = #{cityUuid} where dri_uuid = #{driverUuid} ")
    int updateQueueCity(@Param("cityUuid")String cityUuid,@Param("driverUuid")String driverUuid);

    /**
     * 更新起点
     * @param siteUuid
     * @param driverUuid
     * @return
     */
    @Update("update t_driver_queue set origin_site_uuid = #{siteUuid} where dri_uuid = #{driverUuid} ")
    int updateQueueSite(@Param("siteUuid")String siteUuid,@Param("driverUuid")String driverUuid);
}